# -*- coding：utf-8 -*-
import os

import yaml


class FileRead:
    def __init__(self):
        self.path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "data/")

    def read_data(self, file_name):
        """
        YAML文件读取
        :return: yaml文件数据
        """
        try:
            with open(self.path + file_name, mode='r', encoding="utf8") as f:
                value = yaml.safe_load(f)
                return value
        except Exception as e:
            print(e)


get_data = FileRead()
